﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Quotation
{
    public sealed class TradeType : FlexibleFlagBase<string, TradeType>
    {
        private TradeType(string value) : base(value) { }

        public static readonly TradeType 正常买卖 = new TradeType("A0");
        public static readonly TradeType 新股认购 = new TradeType("A1");
        public static readonly TradeType 配股 = new TradeType("A5");
        public static readonly TradeType 转股回售 = new TradeType("B3");
        public static readonly TradeType 申购赎回 = new TradeType("B7");
        public static readonly TradeType 资金划拔 = new TradeType("B8");
        public static readonly TradeType 权证行权 = new TradeType("C1");
        public static readonly TradeType 质押申转 = new TradeType("C3");

        /// <summary>
        /// 隐式类型转换
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static implicit operator TradeType(string value)
        {
            if (value == null)
                return default(TradeType);
            else
            {
                TradeType rtn;
                TradeType.TryConvert(value, out rtn);
                return rtn;
            }
        }
    }
}
